package org.pounds.control;

import org.pounds.pojo.Ware;
import org.pounds.service.WaresService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("hellserver/wares")
public class WaresControl {

    @Autowired
    private WaresService waresService;

    @GetMapping("all_wares")
    public List<Ware> getAllWares() {
        return waresService.getAllWare();
    }

    @PostMapping("new_sale")
    public void newSaleWare(String name,int num){
        waresService.newSaleWare(name,num);
    }
}
